<?$this->_extends("_layouts/index_layout");?>
<?$this->_block("contents");?>
<script language="javascript" type="text/javascript">
//删除购物车
function deleteCart(cart_id){
	$.ajax({
		type : 'POST',
		url  : '<?php echo url('my/deletecart');?>',
		data : {"cart_id":cart_id},
		success : function(msg){
			if(msg == 1){
				window.open('<?php echo url('my/shoppingcart');?>','_self');
			}
		}		
	});	
}
//清空购物车
function clearCart(){
	$.ajax({
		type : 'POST',
		url  : '<?php echo url('my/clearcart');?>',
		data : {"clear":1},
		success : function(msg){
			if(msg == 1){
				window.open('<?php echo url('my/shoppingcart');?>','_self');
			}
		}		
	});		
}
//加入收藏
function addfavor(course_id) {
	$.get('<?php echo url('index/addfavor');?>', {course_id:course_id}, function(txt) {
		alert(txt);
	});
}
</script>
<div id="gwzt1" class=" ztt"></div>
<!--<div id="gwzt2" class=" ztt"></div>
<div id="gwzt3" class=" ztt"></div>-->

<div class="main">
  <div class="border1 colorbg2">
	<div class="ww240 colorbg gwqd ff2">课程视频</div>
	<div class="ww320 colorbg gwqd ff2">课程详情</div>
	<div class="ww150 colorbg gwqd ff2">价格</div>
	<div class="ww150 colorbg gwqd ff2">操作</div>
    <div class="clear"></div>
    <?php 
		$price_total = 0;
	foreach ($myData as $i=>$row) {
		$price_total += $row->course->price;
		?>
    <div class="ww240 gwqd"><a href="<?php echo url('index/courseread', array('course_id'=>$row->course_id));?>"><img src="<?=$_BASE_DIR.$row->course->img;?>" width="200" height="150" border="0" /></a></div>
    <div class="ww320 gwqd ">
      <div class="ff1"><a href="<?php echo url('index/courseread', array('course_id'=>$row->course_id));?>"><?php echo $row->course->name;?></a></div>
      <div class="left"><?php echo $row->course->introduce;?></div>
      <div><span class="red"><?php echo $row->stu_num;?></span> 人已报名</div>
    </div>
    <div class="ww150 gwqd red magin20t">￥<?php echo $row->course->price;?></div>
    <div class="ww150 gwqd">
      <div class="magin20t"><a href="javascript:void(0);" onclick="javascript:deleteCart(<?php echo $row->cart_id;?>);">删除</a></div>
    </div>
    <div class="clear">
      <hr align="center" width="95%" size="1" noshade="noshade" color="#6699cc"/>
    </div>
    <?php }?>

  </div>
  <div class="fright magin20r">课程价格总计：￥<?php echo $price_total;?> 需为此订单支付： <span class="red">￥<?php echo $price_total;?></span></div>
  <div class="clear"></div>
  <a href="javascript:;" class="btn fright magin20t magin20r magin20b" onclick="javascript:window.open('<?php echo url('my/confirmpayment',array('where_from'=>'shoppingcart'));?>','_self');">立即结算</a>
  <a href="javascript:;" class="gwc fright magin20t magin20r magin20b" onclick="javascript:window.open('<?php echo url('index');?>','_self');">继续购物</a>
  <a href="javascript:;" class="gwc fright magin20t magin20r magin20b" onclick="javascript:clearCart();">清空购物车</a>
  <div class="clear"></div>
</div>
<?$this->_endblock();?>

